package com.changgou.task;

import com.changgou.config.RabbitMQConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author kfzhao
 * @version 1.0
 * @className OrderTask
 * @description
 * @date 2022/1/5 2:32
 */
@Component
@Slf4j
public class OrderTask {
    @Autowired
    private RabbitTemplate rabbitTemplate;
    /**
     * 自动收货
     * @param
     * @return void
     * @throws 
     * @description       
     * @author kfzhao
     * @date 2022/1/5 2:32
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void autoTake() {
        log.info(String.valueOf(new Date()));
        rabbitTemplate.convertAndSend("", RabbitMQConfig.ORDER_TACK, "-");
    }
}
